package Com.javaserver.dao;

import Com.javaserver.bean.train;
import Com.javaserver.utils.DB;

import java.util.List;

public class trainserver {
    //添加培训
    public  static train trainadd(train train){
        int i= DB.executeUpdate("insert into trian (T_people,T_theme,T_purpose,T_time,T_place,T_participants,T_remarks) values(?, ?, ?, ?, ?, ?, ?)",
        train.getT_people(),train.getT_theme(),train.getT_purpose(),train.getT_time(),train.getT_place(),train.getT_participants(),train.getT_remarks());
        if (i == -1){
            return null;
        }
        return train;
    }
    //删除培训
    public  boolean  deletrain(train train){
        String sql="delete from trian where T_id=?";
        int i = DB.executeUpdate(sql,train.getT_id());
        return 1>0;
    }


    //显示列表
    public List tralist(Integer page){
        List list=DB.executeQuery("select * from trian limit ?, 10", (page - 1) * 10);
        return  list;
    }


    //详细查询
    public List trainlist(){
        List list= DB.executeQuery("select * from trian where T_id=?");
        return  list;
    }
}
